<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<title>KM Lancamento</title>
	<link rel="stylesheet" type="text/css" href="css/tabela.css" />
</h:head>
<ui:composition template="/Menu.xhtml">
	<ui:define name="corpo">
		<h:body>
			<f:view encoding="ISO-8859-1">
				<h:form id="kmLancamento">
					<h:messages layout="table" errorStyle="color: red"
						infoStyle="color: green" warnStyle="color: orange"
						fatalStyle="color: gray" showDetail="true" />
					<h1>Lançamento de Despesa</h1>
					<h:panelGrid columns="2">
						<h:outputText value="Nome Usuário" />
						<h:selectOneMenu style="width:300px"
							value="#{kmLancamento.kmLancamento.usuario}"
							disabled="#{not login.usuario.admin}">
							<f:selectItems value="#{kmLancamento.usuarios}" var="u"
								itemLabel="#{u.nome}" itemValue="#{u.login}" />
						</h:selectOneMenu>
						<h:outputText value="Localidade:" />
						<h:inputText style="width:300px"
							value="#{kmLancamento.kmLancamento.localizacao}" maxlength="100">
						</h:inputText>
						<h:outputText value="Data" />
						<p:calendar value="#{kmLancamento.kmLancamento.data}"
							id="popupCal" mode="inline" locale="pt">
							<p:ajax event="dateSelect"
								listener="#{kmLancamento.handleDateSelect}"
								update="txtTipo txtData" />
						</p:calendar>
						<h:outputText value="Data Selecionada" />
						<h:inputText id="txtData" style="width:200px"
							value="#{kmLancamento.kmLancamento.data}" disabled="true">
							<f:convertDateTime pattern="dd/MM/yyyy" />
						</h:inputText>
						<h:outputText value="RDV" />
						<h:inputText id="txtTipo" style="width:200px"
							value="#{kmLancamento.kmLancamento.tipo}" disabled="true" />

						<h:outputText value="Km" />
						<h:inputText style="width:100px"
							value="#{kmLancamento.kmLancamento.km}" maxlength="10">
							<f:convertNumber pattern="#,##0.0" />
						</h:inputText>
					</h:panelGrid>
					<br />
					<h:commandButton styleClass="g-button g-button-submit"
						actionListener="#{kmLancamento.salvar}" value="SALVAR"
						style="width:150px" />
					<h:commandButton styleClass="g-button g-button-submit"
						actionListener="#{kmLancamento.limpar}" value="LIMPAR"
						style="width:150px" />

				</h:form>
			</f:view>
		</h:body>
	</ui:define>
</ui:composition>
</html>